package com.awx.client.navigation.menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;

import javax.swing.JMenuItem;

import com.awx.client.navigation.AwxController;
import com.awx.client.navigation.menu.action.AwxMenuItemAction;

public class AwxMenuItem  implements Serializable{

	private String name;
	private AwxMenuItemAction action;

	public AwxMenuItem() {
	}

	public AwxMenuItem(String name, AwxMenuItemAction action) {
		this.name = name;
		this.action = action;
	}

	public JMenuItem buildMenuItem(AwxController controller) {
		this.action.inyectController( controller );
		JMenuItem menuItem = new JMenuItem( this.name );
		menuItem.addActionListener( action );
		return menuItem;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}


}
